package o;

import android.os.Build;
import android.os.Build.VERSION;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.lang.reflect.InvocationTargetException;

public class bjx {
    public static final boolean ˎ = (d.ˊ > 0);
    @NonNull
    public static final String ॱ = ˎ();

    public static class d {
        public static final int ˊ = ˎ();

        private static int ˎ() {
            int intValue;
            try {
                intValue = ((Integer) bjz.ˋ(bjz.ˎ(bjz.ˎ("com.huawei.android.os.BuildEx$VERSION"), "EMUI_SDK_INT"), null)).intValue();
            } catch (ClassNotFoundException e) {
                intValue = 0;
            } catch (NoSuchFieldException e2) {
                intValue = 0;
            } catch (Exception e3) {
                intValue = 0;
            }
            if (intValue <= 0) {
                intValue = bka.ˏ("ro.build.hw_emui_api_level", 0);
            }
            if (intValue <= 0) {
                return bkb.ˎ(bjx.ॱ);
            }
            return intValue;
        }
    }

    private static String ˎ() {
        String str;
        try {
            str = (String) bjz.ˋ(bjz.ˎ(bjz.ˎ("com.huawei.android.os.BuildEx"), "EMUI_VERSION"), null);
        } catch (ClassNotFoundException e) {
            str = "";
        } catch (NoSuchFieldException e2) {
            str = "";
        } catch (Exception e3) {
            str = "";
        }
        if (TextUtils.isEmpty(str)) {
            str = bka.ˏ("ro.build.version.emui", "");
        }
        return ˎ(str);
    }

    @Nullable
    public static String ˊ() {
        if (!ˎ) {
            return "";
        }
        try {
            return (String) bjz.ˏ(bjz.ˋ(bjz.ˎ("com.huawei.android.os.BuildEx"), "getUDID", new Object[0]), null, new Object[0]);
        } catch (ClassNotFoundException e) {
            return null;
        } catch (NoSuchMethodException e2) {
            return null;
        } catch (InvocationTargetException e3) {
            return "";
        } catch (Exception e4) {
            return "";
        }
    }

    @NonNull
    public static String ˏ() {
        String serial;
        if (VERSION.SDK_INT >= 26) {
            try {
                serial = Build.getSerial();
            } catch (SecurityException e) {
                serial = "";
            }
        } else {
            serial = Build.SERIAL;
        }
        return ˎ(serial);
    }

    private static String ˎ(String str) {
        if (str == null) {
            return "";
        }
        return str;
    }
}
